package differenceOfSum;

public class Solution {
    public int differenceOfSum(int[] nums) {
        return Math.abs(yuansuhe(nums)-shuweihe(nums));
    }
    private int yuansuhe(int[] nums){
        int sum=0;
        for (int i = 0; i < nums.length; i++) {
            sum+=nums[i];
        }
        return sum;
    }
    private int shuweihe(int[] nums){
        int sum=0;
        for (int i = 0; i < nums.length; i++) {
            while(nums[i]>0){
                sum+=nums[i]%10;
                nums[i]/=10;
            }
        }
        return sum;
    }
}
